package com.lepu.app.main.activity;

import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.TextView;

import com.core.lib.application.BaseFragmentActivity;
import com.lepu.app.widget.CustomTopBarNew.OnTopbarNewLeftLayoutListener;
import com.lepu.pasm.R;

public class AppQianDaoActivity extends BaseFragmentActivity implements
		OnTopbarNewLeftLayoutListener {

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.app_qian_dao_activity);

		init();
	}

	@Override
	public void onDestroy() {
		super.onDestroy();
	}

	/**
	 * 添加页面动画，需要重写这个方法，
	 */
	@Override
	public void onBackPressed() {
		finish();
	}
	
	@Override
	public void onTopbarLeftLayoutSelected() {
		finish();
	}


	/**
	 * 初始化方法
	 */
	@SuppressWarnings("unused")
	private void init() {
		String integral = getIntent().getStringExtra("integral");
		
		final TextView textView = (TextView) findViewById(R.id.integral_text);
		textView.setText(integral+"金币");
		
        final Animation zoomAnim = AnimationUtils.loadAnimation(this, R.anim.zoom_anim);
        final Animation translateAnim = AnimationUtils.loadAnimation(this, R.anim.translate_anim);
        textView.startAnimation(translateAnim);
        
        //位移监听
        translateAnim.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationEnd(Animation animation) {
            	textView.setVisibility(View.GONE);
            	finish();
            }
            @Override
            public void onAnimationStart(Animation animation) {
            }
            @Override
            public void onAnimationRepeat(Animation animation) {
            }
        });
        
        ImageView imageView = (ImageView) findViewById(R.id.integral_image);
        AnimationDrawable animationDrawable = (AnimationDrawable) imageView.getDrawable();  
        animationDrawable.start();
        
	}

}
